<?php get_instance()->view('common/header');?>
<style>
    .content-btn-box,.content-box{margin-top:10px;}
    .container {
        width: 100%;
    }
    .add-tag-btn{line-height: 40px;}
    .option-item {
        margin-bottom: 5px;
        position: relative;
    }
    .del-tag-btn{font-size: 14px;line-height: 36px;display: block;margin-bottom: 4px;}
    .del-tag-btn a{color: red;}
</style>
<div class="page-container home">
    <?php get_instance()->view('common/sidebar');?>
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                    <h3 class="page-title"> <?php echo $title;?></h3>
                    <ul class="page-breadcrumb breadcrumb">
                        <li class="btn-group"> <a class="btn default ml_5 return" href="<?php echo getUrl('merchant');?>"><i class="fa fa-chevron-left"></i> 返回</a> </li>
                        <li> <i class="fa fa-home"></i> <a href="<?php echo getUrl('merchant');?>">商家列表 </a><i class="fa fa-angle-right"></i></li>
                        <li><a href="javascript:void(0);"><?php echo $add ? '添加' : '编辑';?></a></li>
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <!-- BEGIN VALIDATION STATES-->
                    <div class="portlet box">
                        <div class="portlet-body form">
                            <!-- BEGIN FORM-->
                            <form action="<?php echo getUrl('merchant/save')?>" class="form-horizontal" method="post" id="main-form" novalidate="novalidate">
                                <div class="form-body">
                                    <div class="form-group">
                                        <label class="control-label col-md-2">头像<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <div class="fileinput fileinput-new" data-provides="fileinput"><input type="hidden">
                                                <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px; line-height: 140px;">
                                                    <img src="<?php echo ! $add ? $info['portrait'] : getDefaultImg();?>" />
                                                </div>
                                                <div>
                                                    <span class="btn default btn-file">
                                                        <span class="fileinput-new">选择图片</span>
                                                            <span class="fileinput-exists">改变</span>
                                                        <input name="portrait" type="file">
                                                    </span>
                                                    <a href="#" class="btn default fileinput-exists" data-dismiss="fileinput">删除</a>
                                                </div>
                                            </div>
                                            <div class="clearfix margin-top-10">
                                                <span>
                                    <i class="fa fa-exclamation-triangle"></i>
                                </span>
                                                图片格式：gif,png,jpg;大小:2MB
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2">手机号码<span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <input class="form-control required" mobile="true" name="mobile" type="tel" value="<?php echo ! $add ? $info['mobile'] : '';?>" maxlength="11" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2">性别<span class="required">*</span></label>
                                        <div class="col-md-6" style="margin-left: 18px;">
                                            <div class="radio-list">
                                                <label class="radio-inline"><input name="gender" <?php if(( ! $add && $info['gender'] == '保密') || $add):?> checked<?php endif;?> value="1" type="radio"> 保密 </label>
                                                <label class="radio-inline"><input name="gender" <?php if( ! $add && $info['gender'] == '男'):?> checked<?php endif;?> value="2" type="radio"> 男 </label>
                                                <label class="radio-inline"><input name="gender" <?php if( ! $add && $info['gender'] == '女'):?> checked<?php endif;?> value="3" type="radio"> 女 </label>
                                            </div>
                                        </div>
                                    </div>

                                    <!-- 密码 -->
                                    <div class="form-group">
                                        <label class="control-label col-md-2">登录密码<span class="required"><?php if ($add) echo '*';?></span></label>
                                        <div class="col-md-6">
                                            <input class="form-control <?php if ($add) echo 'required';?>" id="password" minlength="6" name="password" value="" type="password">
                                        </div>
                                    </div>
                                    <!-- 密码 -->
                                    <div class="form-group">
                                        <label class="control-label col-md-2">确认密码<span class="required"><?php if ($add) echo '*';?></span></label>
                                        <div class="col-md-6">
                                            <input class="form-control <?php if ($add) echo 'required';?>" name="repassword" equalTo="#password" value="" type="password">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2">状态<span class="required">*</span></label>
                                        <div class="col-md-6" style="margin-left: 18px;">
                                            <div class="radio-list">
                                                <label class="radio-inline"><input name="status" <?php if(( ! $add && $info['status'] == 2) || $add):?> checked<?php endif;?> value="2" type="radio"> 启用 </label>
                                                <label class="radio-inline"><input name="status" <?php if( ! $add && $info['status'] == 1):?> checked<?php endif;?> value="1" type="radio"> 禁用 </label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-actionsc fluid">
                                        <div class="col-md-offset-2 col-md-9" style="padding-left: 0;">
                                            <input name="id" value="<?php echo ! $add ? $info['id'] : '';?>" type="hidden">
                                            <button class="btn green"><i class="fa fa-save"></i> 保存</button>
                                            <a class="btn default seach-btn" href="<?php echo getUrl('merchant');?>"><i class="fa fa-chevron-left"></i> 返回</a>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- END VALIDATION STATES-->
                </div>
                <!-- END PAGE CONTENT-->
            </div>
        </div>
    </div>
</div>
<div class="content-box" type="0" index="0">
    <script index="0" id="" name="free_content[]" type="text/plain"></script>
</div>
<script type="text/javascript">
    $(function(){
        $.e_validate.init('#main-form', {});
    });
</script>
</body>
</html>